<template>
  <f-form-layout clearCache v-bind="options">
    {{ model }}
  </f-form-layout>
</template>
<script setup lang="ts">
import { computed, reactive, ref } from 'vue';
const model = reactive({ type: '1' });
const columns = computed(() => {
  return (
    [
      {
        type: 'select',
        label: '类型',
        field: 'type',
        props: {
          options: [
            { label: '类型1', value: '1' },
            { label: '类型2', value: '2' }
          ]
        }
      },
      {
        label: '显示',
        field: 'show',
        type: 'super-set',
        props: { showDefaultOptions: true }
      }
    ] as any
  ).concat(
    model.type == '1'
      ? { field: 'name', label: '姓名', show: (data) => data.show }
      : { field: 'name', label: '姓名', show: (data) => !data.show }
  );
});
const options = reactive({
  model,
  columns: columns
});
</script>
